define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'user/index',
        add_url: 'user/add',
        edit_url: 'user/uedit',
        delete_url: 'user/delete',
        export_url: 'user/export',
        modify_url: 'user/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar:['refresh','delete','export'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'ID',search:false},
                    //{field: 'fid', title: 'fid'},
                    {field: 'name', title: '账号'},
                    {field: 'nickname', title: '昵称'},
                    //{field: 'pw', title: '密码'},
                    //{field: 'ip', title: 'IP'},
                    //{field: 'rank', title: 'rank'},
                    {field: 'tx', title: '头像', templet: ea.table.image,search:false},
                    //{field: 'time', title: 'time'},
                    {field: 'code', title: '邀请码'},
                    {field: 'inviteid', title: '邀请人'},
                    {field: 'invitecs', title: '可兑奖次数',search:false},
                    {width: 250, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});